Skip to content

Move export to v2/codesigngroup#310

Open
lpusok wants to merge 11 commits intomasterfrom
STEP-2132-move-export
Open

Move export to v2/codesigngroup#310
lpusok wants to merge 11 commits intomasterfrom
STEP-2132-move-export

Conversation

@lpusok
Copy link
Contributor

@lpusok lpusok commented Jan 30, 2026

  • Removed some dead code
  • Added few tests
  • Migrated to v2 logger
  • Made package internal
  • Renamed package to codesigngroup

xcode-archive test: https://app.bitrise.io/build/5b1c7b20-754a-4e94-b156-7e8c6b4b7df8

@lpusok lpusok marked this pull request as ready for review January 30, 2026 15:13
"fmt"
"sort"

"github.com/bitrise-io/go-utils/log"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v2 log should be used

}

// String ...
func (group SelectableCodeSignGroup) String() string {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

during the profileutil migration I used a ProfilePrinter structure to overcome the logger dependency: https://github.com/bitrise-io/go-xcode/pull/304/changes#diff-6c679a7bfc6ae37c7cc6d4307691a5af501f7270412e1681b83bf2767bd677ceR19

// CreateEntitlementsSelectableCodeSignGroupFilter ...
func CreateEntitlementsSelectableCodeSignGroupFilter(logger log.Logger, bundleIDEntitlementsMap map[string]plistutil.PlistData) SelectableCodeSignGroupFilter {
return func(group *SelectableCodeSignGroup) bool {
logger.Debugf("Entitlements filter - removes profile if has missing capabilities")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every filter creator needs a logger, just for debug logging what the filter does, what do you think of doing this logging on the caller side?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Especially since on the caller side we already have a logger and this is an internal package.

@lpusok lpusok changed the title Move export Move export to v2/codesigngroup Feb 17, 2026
BundleIDProfilesMap map[string][]profileutil.ProvisioningProfileInfoModel
}

func containsCertificate(installedCertificates []certificateutil.CertificateInfoModel, certificate certificateutil.CertificateInfoModel) bool {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: I suggest using a bit more generic param names, maybe utilising slices.ContainsFunc and moving the function to the end og the file, as this is a private utility func (less important):

func containsCertificate(list []certificateutil.CertificateInfoModel, item certificateutil.CertificateInfoModel) bool {
	return slices.ContainsFunc(list, func(cert certificateutil.CertificateInfoModel) bool {
		return cert.Serial == item.Serial
	})
}

}

if len(matchingProfiles) > 0 {
sort.Sort(ByBundleIDLength(matchingProfiles))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: this slice sort also could be simpler (and without the additional sort helper structure ByBundleIDLength):

slices.SortFunc(matchingProfiles, func(a, b profileutil.ProvisioningProfileInfoModel) int {
	return len(b.BundleID) - len(a.BundleID)
})

The slices.SortFunc comparator returns:

  • Negative if a should come before b
  • Positive if a should come after b
  • Zero if they're equal

Since we want to sort by descending length (longest first), we return len(b.BundleID) - len(a.BundleID).

return groups
}

filteredGroups := []SelectableCodeSignGroup{}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my IDE highlights these: Empty slice declaration using a literal, it should be var filteredGroups []SelectableCodeSignGroup.
There are a few more of these in the package.

)

// CodeSignGroup ...
type CodeSignGroup interface {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this interface used?

}

// NewIOSGroup ...
func NewIOSGroup(certificate certificateutil.CertificateInfoModel, bundleIDProfileMap map[string]profileutil.ProvisioningProfileInfoModel) *Ios {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: constructor usually goes right after the structure definition

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants